<template>
  <!-- 输入框 -->
  <header class="header">
    <h1>小黑记事本</h1>
    <input
      @keyup.enter="addTask"
      placeholder="请输入任务"
      v-model.trim="todoName"
      class="new-todo"
    />
    <button @click="addTask" class="add">添加任务</button>
  </header>
</template>

<script>
export default {
  data() {
    return {
      todoName: '',
    }
  },
  methods: {
    addTask() {
      this.$emit('addTodoName', this.todoName)
      this.todoName = ''
    },
  },
}
</script>

<style>
</style>